﻿
var type = getCookie('jiangjin').split("&")[3].split("=")[1];
if (type == '07332506fa00992798c91411c89023a8') {
    $("#exampleAccordion>li:nth-child(7) a").removeClass("collapsed");
    $("#exampleAccordion>li:nth-child(7) ul").addClass("show");
    $("#exampleAccordion>li:nth-child(7) ul>li:nth-child(4)").addClass("active");
}else{
    $("#exampleAccordion>li:nth-child(4) a").removeClass("collapsed");
    $("#exampleAccordion>li:nth-child(4) ul").addClass("show");
    $("#exampleAccordion>li:nth-child(4) ul>li:nth-child(2)").addClass("active");
}
function submit() {
    var bootstrapValidator = $(".ChangePaw").data('bootstrapValidator');
    bootstrapValidator.validate();
    if (bootstrapValidator.isValid()) {
        var option = {
            type: 'post',
            url: '/Member/EditPwd',
            data: { oldPwd: $("#oldPaw").val(), pwd: $("#newPaw").val(), type: $(".selectpicker").val() },
            callback: SetMode
        }
        swGather.swAjax(option)
    }
}
function SetMode(data) {
    layer.msg(data.Msg);
}

$(".ChangePaw").bootstrapValidator({
    message: '无效的值',
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh',
    },
    fields: {
        oldPaw: {
            message: '无效的数值',
            validators: {
                notEmpty: {
                    message: '老密码不能为空'
                }
            }
        },
        newPaw: {
            message: '无效的数值',
            validators: {
                notEmpty: {
                    message: '新密码不能为空'
                },
                different: {
                    field: "oldPaw",
                    message:"不能与老密码相同"
                }
            }
        },
        newPaw1: {
            message: '无效的数值',
            validators: {
                notEmpty: {
                    message: '新密码不能为空'
                },                
                identical: {
                    field: "newPaw",
                    message:"两次密码不一致"
                },
                different: {
                    field: "oldPaw",
                    message: "不能与老密码相同"
                }
            }
        }
    }
})